﻿using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	void Jump()
	{
		this.rigidbody2D.AddForce(new Vector2(0,150));
	}
	void PhoneController()
	{
		try
		{
			Touch touch = Input.GetTouch(0);
			if(touch.phase == TouchPhase.Began && touch.position.y > Camera.main.pixelHeight/2)
			{
				Jump();
				
			}
		}
		catch
		{

		//	Debug.Log("No Touches Found");
		}
		if(Input.mousePosition.y > Camera.main.pixelHeight/3)
		{
			Debug.Log(Input.mousePosition.y );
		}
		
	}
	// Update is called once per frame
	void Update () {
#if UNITY_ANDROID 
		PhoneController();
#else
		if(Input.GetKeyDown(KeyCode.W))
		 {
			Jump();
		   
		}
#endif
	}
}
